#include <iostream>
#include "Player.h"

using namespace std;

Player::Player() {
	name = "Unnamed";
	num_moves = 0;
	position.x = position.y = 0;
}

string Player::get_name() {
	name;
}

void Player::set_name(string _name) {
	name = _name;
}

void Player::prompt_name() {
	string name;
	cout << "Type in your name: ";
	cin >> name;
	set_name(name);
}

void Player::move_player(int how_many) {	
	if(how_many == -1) {
		how_many = Util::roll_die();
	}

	num_moves++;
	
	position.x += how_many;
	
	// if displacement causes player to clash with x boundary
	if(position.x >= MAX_WIDTH) {
		position.x = position.x % MAX_WIDTH;
		position.y++;
	}
}

Point Player::get_position() {
	return position;
}
